#include "orthogonal_list.h"
#include <stdio.h>
#include <assert.h>

void test_update() {
    printf("test UpdateElement\n");
    struct CrossList *cl = ol_create(5, 5);

    int a = 1;
    ol_update(cl, 1, 2,  (ElemType)&a);

    int b = 2;
    ol_update(cl, 2, 2,  (ElemType)&b);

    ol_release(cl);
}

void test_find(){
    printf("test FindElement\n");
    struct CrossList *cl = ol_create(5, 5);
    ElemType value = ol_get(cl, 1, 2);
    assert(value == NULL);

    ol_release(cl);
}

void test_print() {
    struct CrossList *cl = ol_create(5, 5);
    int a = 1;
    ol_update(cl, 1, 2, &a);
    int b = 2;
    ol_update(cl, 2, 2, &b);
    int f = 6;
    ol_update(cl, 0, 2, &f);
    int g = 7;
    ol_update(cl, 0, 4, &g);
    int h = 8;
    ol_update(cl, 4, 4, &h);
    int i = 9;
    ol_update(cl, 4, 0, &i);
    int j = 10;
    ol_update(cl, 0, 0, &j);

    int c= 3;
    ol_update(cl, 2, 3, &c);
    int d= 4;
    ol_update(cl, 2, 3, &d);
    int e= 5;
    ol_update(cl, 2, 1, &e);

    int k= 11;
    ol_update(cl, 3, 1, &k);
    int l= 12;
    ol_update(cl, 3, 3, &l);
    ol_print(cl);
    ol_release(cl);
}

void test() {
    test_find();
    test_update();
    test_print();
}


int main(int argc, char const *argv[])
{
    test();
    return 0;
}
